import { createI18n } from 'vue-i18n' //引入vue-i18n组件
import en from './en.js'
import es from './es.js'
import { getLangType } from '@/utils/util.js'

//注册i8n实例并引入语言文件
const langObj = getLangType()

export const localeData = {
  legacy: false,
  globalInjection: true,
  locale: langObj.locale === 'es' ? 'es' : 'en',
  messages: {
    en,
    es
  }
}

// setup i18n instance with glob
export const i18n = createI18n(localeData)
